package cn.iocoder.yudao.module.api.dine.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 菜品属性枚举
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/08/01
 */
@RequiredArgsConstructor
@Getter
public enum DineStatusEnum implements EnumValuable {
    INITIAL(0, "无"),
    PENDING(10, "待接单"),
    ACCEPTED(20, "已接单"), // 备餐中
    REJECTED(21, "已拒单"),
    ASSIGNED(22, "已派单"),
    PACKED(30, "已出餐"), // 待取餐
    DELIVERING(40, "配送中"),
    ARRIVED(50, "已送达"),
    ;

    @EnumValue
    private final Integer value;
    private final String name;

    public static DineStatusEnum getByValue(Integer value) {
        return Arrays.stream(values())
                .filter(item -> item.getValue().equals(value))
                .findFirst().orElse(INITIAL);
    }

}
